package com.baogu.factoryjob.service.impl;

import com.baogu.factoryjob.manager.JobManager;
import com.baogu.factoryjob.service.JobService;
import com.baogu.model.job.JobManage;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JobServiceImpl implements JobService {

    @Autowired
    JobManager jobManager;
    @Autowired
    TaskServiceImpl taskServiceImpl;

    @Override
    public Integer addJob(JobManage jobManage){
        Integer result = 0;
        try {
            taskServiceImpl.addJob(jobManage);
            result = jobManager.addJob(jobManage);
        } catch (SchedulerException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return result;
    }

    @Override
    public JobManage getJobById(String jobId) {
        return null;
    }

    @Override
    public Integer deleteJob(String jobId) {
        return null;
    }

    @Override
    public Integer updateJob(JobManage jobManage) {
        return null;
    }

    @Override
    public List<JobManage> getJobList(JobManage jobManage) {
        return jobManager.getJobList(jobManage);
    }

    @Override
    public Integer starJob(JobManage jobManage) {
        return null;
    }

    @Override
    public Integer stopJob(JobManage jobManage) {
        return null;
    }
}
